<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Zend Gdata API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="../css/template.css" type="text/css"></link><script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script><script type="text/javascript" src="../js/jquery.tools.min.js"></script><script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js"></script><script type="text/javascript" src="../js/template.js"></script></head><body><div id="content"><h1 class="file">Http/Client/Adapter/Test.php</h1><div id="file-nav-box"><div id="file-nav-options">
              Show:
              <img src="../images/icons/visibility_public.png" alt="Public" id="show-public"></img><img src="../images/icons/visibility_protected.png" alt="Protected" id="show-protected"></img><img src="../images/icons/visibility_private.png" alt="Private" id="show-private"></img><span class="attribute" id="show-inherited">inherited</span></div><div id="file-nav-container"><ul id="file-nav"><li><a href="#classes"><img src="../images/icons/class.png" alt="Class" height="14"></img>
                          Classes
                      </a><ul><li><a href="#\Zend_Http_Client_Adapter_Test">\Zend_Http_Client_Adapter_Test</a></li></ul></li></ul><div style="clear: left;"></div></div><div id="file-nav-tab">
              Table of Contents
          </div></div><a name="top" class="anchor"></a><div id="file-description"><div class="short-description">Zend Framework</div><div class="long-description"><p>LICENSE</p>

<p>This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.</p></div></div><dl class="file-info"><dt>Category</dt><dd>Zend
         
    </dd><dt>Copyright</dt><dd>Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
         
    </dd><dt>License</dt><dd><a href="http://framework.zend.com/license/new-bsd">New BSD License</a>
         
    </dd><dt>Package</dt><dd>Zend_Http
         
    </dd><dt>Subpackage</dt><dd>Client_Adapter
         
    </dd><dt>Version</dt><dd>$Id: Test.php 24593 2012-01-05 20:35:02Z matthew $
         
    </dd></dl><a name="classes" class="anchor"></a><a id="\Zend_Http_Client_Adapter_Test" class="anchor"></a><h2 class="class">\Zend_Http_Client_Adapter_Test<div class="to-top"><a href="#top">jump to top</a></div></h2><div class="class"><small class="package"><b>Package: </b>Zend\Http\Client\Adapter</small><div class="short-description">A testing-purposes adapter.</div><div class="long-description"><p>Should be used to test all components that rely on Zend_Http_Client,
without actually performing an HTTP request. You should instantiate this
object manually, and then set it as the client's adapter. Then, you can
set the expected response using the setResponse() method.</p></div><dl class="class-info"><dt>Implements</dt><dd><a href="../files/Http.Client.Adapter.Interface.html#\Zend_Http_Client_Adapter_Interface">\Zend_Http_Client_Adapter_Interface</a></dd><dt>Category</dt><dd>Zend
         
    </dd><dt>Copyright</dt><dd>Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
         
    </dd><dt>License</dt><dd><a href="http://framework.zend.com/license/new-bsd">New BSD License</a>
         
    </dd></dl><h3>Properties</h3><div><a id="\Zend_Http_Client_Adapter_Test::$_nextRequestWillFail" class="anchor"></a><div class="property protected"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_protected.png" style="margin-right: 5px" alt="protected"></img>boolean <span class="highlight">$_nextRequestWillFail</span> = false</code><div class="description"><div class="short-description">Wether or not the next request will fail with an exception</div></div><div class="code-tabs"><div class="long-description"></div><strong>Default value</strong><code>false</code><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>boolean</dd></dl></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::$config" class="anchor"></a><div class="property protected"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_protected.png" style="margin-right: 5px" alt="protected"></img>array <span class="highlight">$config</span> = array()</code><div class="description"><div class="short-description">Parameters array</div></div><div class="code-tabs"><div class="long-description"></div><strong>Default value</strong><code>array()</code><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>array</dd></dl></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::$responseIndex" class="anchor"></a><div class="property protected"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_protected.png" style="margin-right: 5px" alt="protected"></img>integer <span class="highlight">$responseIndex</span> = 0</code><div class="description"><div class="short-description">Current position in the response buffer</div></div><div class="code-tabs"><div class="long-description"></div><strong>Default value</strong><code>0</code><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>integer</dd></dl></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::$responses" class="anchor"></a><div class="property protected"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_protected.png" style="margin-right: 5px" alt="protected"></img>array <span class="highlight">$responses</span> = array("HTTP/1.1 400 Bad Request\r\n\r\n")</code><div class="description"><div class="short-description">Buffer of responses to be returned by the read() method.</div></div><div class="code-tabs"><div class="long-description"><p>Can be
set using setResponse() and addResponse().</p></div><strong>Default value</strong><code>array("HTTP/1.1 400 Bad Request\r\n\r\n")</code><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>array</dd></dl></div><div class="clear"></div></div></div><h3>Methods</h3><div><a id="\Zend_Http_Client_Adapter_Test::__construct()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">__construct</span><span class="nb-faded-text">()</span> : void</code><div class="description"><p class="short_description">Adapter constructor, currently empty.</p></div><div class="code-tabs"><div class="long-description"><p>Config is set using setConfig()</p></div></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::addResponse()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">addResponse</span><span class="nb-faded-text">(string $response)</span> : void</code><div class="description"><p class="short_description">Add another response to the response buffer.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$response</th><td>string</td><td><em><p>Zend_Http_Response|$response</p>
</em></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::close()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">close</span><span class="nb-faded-text">()</span> : void</code><div class="description"><p class="short_description">Close the connection (dummy)</p></div><div class="code-tabs"><div class="long-description"></div></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::connect()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">connect</span><span class="nb-faded-text">(string $host, int $port = 80, boolean $secure = false)</span> : void</code><div class="description"><p class="short_description">Connect to the remote server</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$host</th><td>string</td><td><em></em></td></tr><tr><th>$port</th><td>int</td><td><em></em></td></tr><tr><th>$secure</th><td>boolean</td><td><em></em></td></tr></table><strong>Throws</strong><table class="argument-info"><thead><tr><th>Exception</th><th>Description</th></tr></thead><tr><td><a href="../files/Http.Client.Adapter.Exception.html#\Zend_Http_Client_Adapter_Exception">\Zend_Http_Client_Adapter_Exception</a></td><td><em></em></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::getConfig()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">getConfig</span><span class="nb-faded-text">()</span> : array</code><div class="description"><p class="short_description">Retrieve the array of all configuration options</p></div><div class="code-tabs"><div class="long-description"></div><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>array</td><td></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::read()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">read</span><span class="nb-faded-text">()</span> : string</code><div class="description"><p class="short_description">Return the response set in $this->setResponse()</p></div><div class="code-tabs"><div class="long-description"></div><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>string</td><td></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::setConfig()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">setConfig</span><span class="nb-faded-text">(\Zend_Config $config = array())</span> : void</code><div class="description"><p class="short_description">Set the configuration array for the adapter</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$config</th><td>\Zend_Config</td><td><em><p>| array $config</p>
</em></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::setNextRequestWillFail()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">setNextRequestWillFail</span><span class="nb-faded-text">(boolean $flag)</span> : <a href="../files/Http.Client.Adapter.Test.html#\Zend_Http_Client_Adapter_Test">\Zend_Http_Client_Adapter_Test</a></code><div class="description"><p class="short_description">Set the nextRequestWillFail flag</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$flag</th><td>boolean</td><td><em></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td><a href="../files/Http.Client.Adapter.Test.html#\Zend_Http_Client_Adapter_Test">\Zend_Http_Client_Adapter_Test</a></td><td></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::setResponse()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">setResponse</span><span class="nb-faded-text">(<a href="../files/Http.Response.html#\Zend_Http_Response">\Zend_Http_Response</a> | array | string $response)</span> : void</code><div class="description"><p class="short_description">Set the HTTP response(s) to be returned by this adapter</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$response</th><td><a href="../files/Http.Response.html#\Zend_Http_Response">\Zend_Http_Response</a> | array | string</td><td><em></em></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::setResponseIndex()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">setResponseIndex</span><span class="nb-faded-text">(integer $index)</span> : void</code><div class="description"><p class="short_description">Sets the position of the response buffer.</p></div><div class="code-tabs"><div class="long-description"><p>Selects which
response will be returned on the next call to read().</p></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$index</th><td>integer</td><td><em></em></td></tr></table></div><div class="clear"></div></div><a id="\Zend_Http_Client_Adapter_Test::write()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">write</span><span class="nb-faded-text">(string $method, <a href="../files/Uri.Http.html#\Zend_Uri_Http">\Zend_Uri_Http</a> $uri, string $http_ver = '1.1', array $headers = array(), string $body = '')</span> : string</code><div class="description"><p class="short_description">Send request to the remote server</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$method</th><td>string</td><td><em></em></td></tr><tr><th>$uri</th><td><a href="../files/Uri.Http.html#\Zend_Uri_Http">\Zend_Uri_Http</a></td><td><em></em></td></tr><tr><th>$http_ver</th><td>string</td><td><em></em></td></tr><tr><th>$headers</th><td>array</td><td><em></em></td></tr><tr><th>$body</th><td>string</td><td><em></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>string</td><td>Request as string</td></tr></table></div><div class="clear"></div></div></div></div></div><small class="footer">
            Documentation was generated by
            <a href="http://phpdoc.org">phpDocumentor
                2.0.0a12</a>.
        </small></body></html>
